﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FooFun.DataElements.Dtos
{
    public class EmptyDataElement : DataElement
    {
        public EmptyDataElement()
        {

        }

        IDataElement parent;

        public override IDataElement Parent
        {
            get { return parent; }
        }

        public EmptyDataElement(Exception ex,
            string message, IDataElement parent)
        {
            exception = ex;
            this.message = message;
            this.parent = parent;
        }

        public EmptyDataElement(Exception ex)
            : this(ex, null, null)
        {

        }

        public EmptyDataElement(string message)
            : this(null, message, null)
        {

        }

        public EmptyDataElement(string message, IDataElement parent)
            : this(null, message, parent)
        {

        }


        Exception exception;

        public Exception Exception
        {
            get { return exception; }
            set { exception = value; }
        }

        string message;

        public string Message
        {
            get
            {
                if (message == null && exception != null)
                {
                    return exception.Message;
                }
                return message;
            }
            set { message = value; }
        }
    }
}
